import os
import numpy as np
# def _get_img_info():
#     info_all = os.listdir(imgPath)
#     info = [file for file in info_all if file.endswith('.csv')]
#     infoStr = [filenames.split('.')[0] for filenames in info]
#     color = sorted(set([colornames[0] for colornames in infoStr]),reverse=True)
#     gray_level = [int(gray_levelSub[1:]) for gray_levelSub in infoStr[:int(len(infoStr)/len(color))]]
#
#     gray_level = list(gray_level)
#     ori_idx = np.argsort(gray_level)
#     gray_level = sorted(gray_level)

def _get_pattern_list_ini_info(cfg):
    pattern_list = cfg['Database']['gray_pattern']
    pattern_list = pattern_list.split(',')
    color = list(sorted(set([color_s[0] for color_s in pattern_list]))[::-1])
    gray_list = np.array(sorted(set([gray_s[1::] for gray_s in pattern_list])))
    return color, gray_list
